<template>
  <el-dialog
    :title="'查看详情'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="120px" class="demo-table-expand">
      <el-form-item label="职业主键ID" prop="professionId">
        <span>{{dataForm.professionId || '无'}}</span>
      </el-form-item>
      <el-form-item label="真实姓名" prop="studentName">
        <span>{{dataForm.studentName || '无'}}</span>
      </el-form-item>
      <el-form-item label="登录用户名" prop="userName">
        <span>{{dataForm.userName || '无'}}</span>
      </el-form-item>
      <el-form-item label="密码" prop="studentPassword">
        <span>{{dataForm.studentPassword}}</span>
      </el-form-item>
      <el-form-item label="学号" prop="studentNo">
        <span>{{ dataForm.studentNo}}</span>
      </el-form-item>
      <el-form-item label="性别" prop="studentGender">
        <span>{{ dataForm.studentGender}}</span>
      </el-form-item>
      <el-form-item label="邮箱" prop="studentEmail">
        <span>{{ dataForm.studentEmail}}</span>
      </el-form-item>
      <el-form-item label="头像" prop="studentHeader">
        <span>{{ dataForm.studentHeader}}</span>
      </el-form-item>
      <el-form-item label="手机号码" prop="studentMobile">
        <span>{{dataForm.studentMobile }}</span>
      </el-form-item>
      <el-form-item label="签名" prop="studentSign">
        <span>{{dataForm.studentSign }}</span>
      </el-form-item>
      <el-form-item label="微信号" prop="studentWechat">
        <span>{{ dataForm.studentWechat}}</span>
      </el-form-item>
      <el-form-item label="qq号" prop="studentQq">
        <span>{{ dataForm.studentQq}}</span>
      </el-form-item>
      <el-form-item label="出生日期" prop="birthday">
        <span>{{ dataForm.birthday}}</span>
      </el-form-item>
      <el-form-item label="学历" prop="studentEducation">
        <span>{{dataForm.studentEducation}}</span>
      </el-form-item>
      <el-form-item label="大学名称" prop="collegeName">
        <span>{{dataForm.collegeName}}</span>
      </el-form-item>
      <el-form-item label="专业名称" prop="studentProfession">
        <span>{{dataForm.studentProfession }}</span>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <span>{{dataForm.status }}</span>
      </el-form-item>
      <el-form-item label="学生排序号" prop="orderNum">
        <span>{{dataForm.orderNum }}</span>
      </el-form-item>
      <el-form-item label="籍贯" prop="censusRegister">
        <span>{{dataForm.censusRegister }}</span>
      </el-form-item>
      <el-form-item label="身份证" prop="idCard">
        <span>{{dataForm.idCard }}</span>
      </el-form-item>
      <el-form-item label="是否推荐" prop="isRefer">
        <span>{{ dataForm.isRefer}}</span>
      </el-form-item>
      <el-form-item label="创建人" prop="createUser">
        <span>{{dataForm.createUser }}</span>
      </el-form-item>
      <el-form-item label="创建时间" prop="createTime">
        <span>{{dataForm.createTime}}</span>
      </el-form-item>
      <el-form-item label="修改人" prop="updateUser">
        <span>{{dataForm.updateUser }}</span>
      </el-form-item>
      <el-form-item label="修改时间" prop="updateTime">
        <span>{{ dataForm.updateTime}}</span>
      </el-form-item>
      <el-form-item label="推荐码盐" prop="referSalt">
        <span>{{ dataForm.referSalt}}</span>
      </el-form-item>
      <el-form-item label="推荐加密码" prop="referNum">
        <span>{{dataForm.referNum }}</span>
      </el-form-item>
      <el-form-item label="推荐码" prop="referOriginalNum">
        <span>{{ dataForm.referOriginalNum}}</span>
      </el-form-item>
      <el-form-item label="老师ID" prop="teacherId">
        <span>{{ dataForm.teacherId}}</span>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          studentId: 0,
          professionId: '',
          studentName: '',
          userName: '',
          studentPassword: '',
          studentNo: '',
          studentGender: '',
          studentEmail: '',
          studentHeader: '',
          studentMobile: '',
          studentSign: '',
          studentWechat: '',
          studentQq: '',
          birthday: '',
          studentEducation: 0,
          collegeName: '',
          studentProfession: '',
          status: '',
          orderNum: '',
          censusRegister: '',
          idCard: '',
          isRefer: '',
          createUser: '',
          createTime: '',
          updateUser: '',
          updateTime: '',
          referSalt: '',
          referNum: '',
          referOriginalNum: '',
          teacherId: ''
        }
      }
    },
    methods: {
      init (id) {
        this.dataForm.studentId = id || 0
        this.visible = true
        this.$nextTick(() => {
          if (this.dataForm.studentId) {
            this.$http({
              url: this.$http.adornUrl(`/manage/student/info/${this.dataForm.studentId}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.professionId = data.mStudent.professionId
                this.dataForm.studentName = data.mStudent.studentName
                this.dataForm.userName = data.mStudent.userName
                this.dataForm.studentPassword = data.mStudent.studentPassword
                this.dataForm.studentNo = data.mStudent.studentNo
                this.dataForm.studentGender = data.mStudent.studentGender
                this.dataForm.studentEmail = data.mStudent.studentEmail
                this.dataForm.studentHeader = data.mStudent.studentHeader
                this.dataForm.studentMobile = data.mStudent.studentMobile
                this.dataForm.studentSign = data.mStudent.studentSign
                this.dataForm.studentWechat = data.mStudent.studentWechat
                this.dataForm.studentQq = data.mStudent.studentQq
                this.dataForm.birthday = data.mStudent.birthday
                this.dataForm.studentEducation = data.mStudent.studentEducation
                this.dataForm.collegeName = data.mStudent.collegeName
                this.dataForm.studentProfession = data.mStudent.studentProfession
                this.dataForm.status = data.mStudent.status
                this.dataForm.orderNum = data.mStudent.orderNum
                this.dataForm.censusRegister = data.mStudent.censusRegister
                this.dataForm.idCard = data.mStudent.idCard
                this.dataForm.isRefer = data.mStudent.isRefer
                this.dataForm.createUser = data.mStudent.createUser
                this.dataForm.createTime = data.mStudent.createTime
                this.dataForm.updateUser = data.mStudent.updateUser
                this.dataForm.updateTime = data.mStudent.updateTime
                this.dataForm.referSalt = data.mStudent.referSalt
                this.dataForm.referNum = data.mStudent.referNum
                this.dataForm.referOriginalNum = data.mStudent.referOriginalNum
                this.dataForm.teacherId = data.mStudent.teacherId
              }
            })
          }
        })
      }
    }
  }
</script>
<style>
  .demo-table-expand {
    font-size: 0;
    overflow: hidden;
  }

  .demo-table-expand label {
    width: 100px;
    color: #99a9bf;
  }

  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
    float: left;
  }
</style>
